import request from '@/utils/request'

// 获取面试文章列表
export const getArticles = params => {
  return request({
    method: 'GET',
    url: '/articles',
    params
  })
}

// 发起添加新文章的请求
export const addArticle = data => {
  return request({
    method: 'POST',
    url: '/articles',
    data
  })
}

// 渲染修改文章的请求
export const changeArticle = id => {
  return request({
    method: 'GET',
    url: `/articles/${id}`
  })
}

// 发起修改文章的请求
export const editArticle = data => {
  return request({
    method: 'PUT',
    url: `/articles/${data.id}`,
    data
  })
}

// 删除文章的请求
export const deleteArticles = id => {
  return request({
    method: 'DELETE',
    url: `/articles/${id}`
  })
}

// 文章状态的请求
export const startUserings = data => {
  return request({
    method: 'POST',
    url: `/articles/${data.id}/${data.state}`,
    data
  })
}
